//
//  WorkMergeView.m
//  Rail
//
//  Created by hychen on 2018/3/2.
//  Copyright © 2018年 Hychen. All rights reserved.
//

#import "WorkMergeView.h"
#import "WorkTableViewCell.h"

@implementation WorkMergeView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
    }
    return self;
}

- (void)setupWorkView:(NSArray *)array {
    if (array.count < 1) {
        return;
    }
    
    NSInteger count = array.count;
    BOOL showMore = NO;
    if (array.count > 3) {
        showMore = YES;
        count = 3;
    }
    
    CGFloat mergeHeight = 0;
    for (int i = 0; i < count; ++i) {
        WorkTableViewCell *work = [[[NSBundle mainBundle] loadNibNamed:@"WorkTableViewCell" owner:nil options:nil] lastObject];
        //赋值模型
        
        if (showMore && count == 3) {
            work.frame = CGRectMake(0, mergeHeight, SCREEN_WIDTH, 255);
            [work showMore:^{
                
            }];
        }
        else {
            work.frame = CGRectMake(0, mergeHeight, SCREEN_WIDTH, 220);
        }
     
        [work setBlockClickFav:^(id obj, UIButton *btn) {
            
        }];
        
        [work setBlockClickRefresh:^(id obj, NSIndexPath *indexPath) {
            
        }];
        
        [work setBlockClickXiangqing:^(id obj) {
            
        }];
    }
}



@end
